package com.library.uiframework.widget.actionbar;



/**
 * action更多菜单单个item实例
 * Created by louzhen on 15/12/26.
 */
public class ActionMenuItem implements IAdapterDataViewModel, IPopupAdapterData {

    private int mId = 0;
    private String mName = null;
    private int mIconResId = 0;
    private boolean mHasRedRot = false;
    private boolean mIsSelected = false;

    public ActionMenuItem() {
    }

    /**
     * 构造方法
     *
     * @param id   id
     * @param name item名字
     */
    public ActionMenuItem(int id, String name) {
        this(id, name, 0, false);
    }

    /**
     * 构造方法
     *
     * @param id        id
     * @param name      item名字
     * @param iconResId icon资源id
     */
    public ActionMenuItem(int id, String name, int iconResId) {
        this(id, name, iconResId, false);
    }

    /**
     * 构造方法
     *
     * @param id        id
     * @param name      item名字
     * @param hasRedRot 是否有小红点
     */
    public ActionMenuItem(int id, String name, boolean hasRedRot) {
        this(id, name, 0, hasRedRot);
    }

    /**
     * 构造方法
     *
     * @param id        id
     * @param name      item名字
     * @param iconResId icon资源id
     * @param hasRedRot 是否有小红点
     */
    public ActionMenuItem(int id, String name, int iconResId, boolean hasRedRot) {
        this.mId = id;
        this.mName = name;
        this.mIconResId = iconResId;
        this.mHasRedRot = hasRedRot;
    }

    public ActionMenuItem(int id, String name, int iconResId, boolean hasRedRot, boolean isSelected) {
        mId = id;
        mName = name;
        mIconResId = iconResId;
        mHasRedRot = hasRedRot;
        mIsSelected = isSelected;
    }

    /**
     * 获取menu id
     *
     * @return menu id
     */
    public int getId() {
        return mId;
    }

    /**
     * 设置menu id
     *
     * @param id id
     */
    public void setId(int id) {
        this.mId = id;
    }

    /**
     * 获取item显示名字
     *
     * @return 名字
     */
    public String getName() {
        return mName;
    }

    /**
     * 设置item显示名字
     *
     * @param name 名字
     */
    public void setName(String name) {
        this.mName = name;
    }

    public int getIconResId() {
        return mIconResId;
    }

    public void setIconResId(int iconResId) {
        this.mIconResId = iconResId;
    }

    /**
     * item是否有小红点
     *
     * @return 是否
     */
    public boolean hasRedRot() {
        return mHasRedRot;
    }

    /**
     * 当前item是否有小红点
     *
     * @param hasRedRot 是否有小红点
     */
    public void hasRedRot(boolean hasRedRot) {
        this.mHasRedRot = hasRedRot;
    }

    public boolean isSelected() {
        return mIsSelected;
    }

    public void setSelected(boolean selected) {
        mIsSelected = selected;
    }

    @Override
    public Class getViewModelType() {
        return ActionMenuListHolderView.class;
    }

    @Override
    public String getItemText() {
        return mName;
    }
}
